﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.IO.IsolatedStorage;

namespace QLibrary.Helper
{
    public class IsolatedStorageHelper
    {
        private static IsolatedStorageSettings isoSetting = IsolatedStorageSettings.ApplicationSettings;

        public static void AddToSetting(string key,object value)
        {
            if (isoSetting.Contains(key))
            {
                isoSetting.Remove(key);
            }
            isoSetting.Add(key, value);
            isoSetting.Save();
        }

        public static void DeleteSetting(string key)
        {
            isoSetting.Remove(key);
            isoSetting.Save();
        }

        public static T GetSetting<T>(string key)
        {
            T value;
            isoSetting.TryGetValue(key, out value);
            return value;
        }
    }
}
